import React, { useState } from "react";
import { Spin } from "antd";
import classnames from "classnames";
import "./index.scss";

/**
 * @description 结果区域外包装
 * @param spinTip loading提示
 * @param ajaxLoad loading显示状态
 * @param nodata 暂无数据是否可见
 */

function ResultWrap(props) {
  const { spinTip = "", className, ajaxLoad, nodata } = props;

  return (
    <div className={classnames("zz-result-wrap", className ? className : "")}>
      {ajaxLoad === true ? (
        <div className="result-load">
          <Spin size="large" tip={spinTip} />
        </div>
      ) : (
        <>
          {nodata ? (
            <div className="result-nodata">
              <div className="nodata">暂无数据</div>
            </div>
          ) : (
            <div className="result-data">{props.children}</div>
          )}
        </>
      )}
    </div>
  );
}

export default ResultWrap;
